package com.rdtravel.services;

import com.rdtravel.entities.Parameters;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.validation.Validator;

import org.springframework.beans.factory.annotation.Autowired;

abstract class JPAService {
	protected EntityManager entityManager;
	protected Validator validator;

	@PersistenceContext
	void setEntityManager(EntityManager entityManager) {
		this.entityManager = entityManager;
	}

	@Autowired
	public void setValidator(Validator validator) {
		this.validator = validator;
	}

	protected Parameters findParameters() {
		return entityManager.find(Parameters.class, 1L);
	}

}